Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(optimizer): ensure column name unique when create MV #1363

Merged
merged 15 commits into from
Mar 29, 2022

Conversation

st1page
Copy link
Contributor

@st1page st1page commented Mar 29, 2022

What's changed and what's your intention?

PLEASE DO NOT LEAVE THIS EMPTY !!!

  • add a idx on the row_id columns
  • rewrite every row_id columns when create mv.
  • add check if the user column name starts with "_row_id" when create table
  • add check if the user alias name starts with "_row_id" when query.
  • add check if two columns have same name when create mv.
  • fix project schema name derive

Checklist

  • I have written necessary docs and comments
  • I have added necessary unit tests and integration tests

Refer to a related PR or issue link (optional)

#1331

Copy link
Contributor

@skyzh skyzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Is # valid in column name in Postgres?

@st1page
Copy link
Contributor Author

st1page commented Mar 29, 2022

LGTM. Is # valid in column name in Postgres?

I am not sure, and we can change it anytime

@st1page st1page requested a review from BowenXiao1999 March 29, 2022 03:24
@codecov
Copy link

codecov bot commented Mar 29, 2022

Codecov Report

Merging #1363 (3c3f650) into main (aca1e20) will increase coverage by 0.00%.
The diff coverage is 80.24%.

@@            Coverage Diff            @@
##               main    #1363   +/-   ##
=========================================
  Coverage     70.08%   70.08%           
  Complexity     2766     2766           
=========================================
  Files          1030     1030           
  Lines         89098    89155   +57     
  Branches       1790     1790           
=========================================
+ Hits          62442    62482   +40     
- Misses        25765    25782   +17     
  Partials        891      891           
Flag Coverage Δ
java 61.01% <ø> (ø)
rust 72.04% <80.24%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rust/frontend/src/binder/select.rs 90.59% <28.57%> (-3.95%) ⬇️
rust/frontend/src/handler/create_table.rs 93.87% <58.33%> (-3.27%) ⬇️
...tend/src/optimizer/plan_node/stream_materialize.rs 87.50% <84.21%> (-0.94%) ⬇️
rust/frontend/src/catalog/mod.rs 100.00% <100.00%> (ø)
rust/frontend/src/catalog/table_catalog.rs 99.49% <100.00%> (ø)
rust/frontend/src/handler/create_mv.rs 97.95% <100.00%> (ø)
rust/frontend/src/handler/create_source.rs 86.98% <100.00%> (+0.07%) ⬆️
rust/frontend/src/optimizer/mod.rs 93.24% <100.00%> (ø)
...rontend/src/optimizer/plan_node/logical_project.rs 97.19% <100.00%> (+0.07%) ⬆️
.../src/executor/managed_state/aggregation/extreme.rs 90.09% <0.00%> (-0.28%) ⬇️
... and 1 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@st1page st1page enabled auto-merge (squash) March 29, 2022 03:33
@st1page st1page merged commit 9d731c2 into main Mar 29, 2022
@st1page st1page deleted the sts/optimizer_gen_mv_make_column_name_unique branch March 29, 2022 03:35
Copy link
Contributor

@BowenXiao1999 BowenXiao1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. BTW, we also need to fix the panic column name dup assert in table_catalog.rs L115?

Comment on lines +35 to +37
pub fn gen_row_id_column_name(idx: usize) -> String {
ROWID_PREFIX.to_string() + "#" + &idx.to_string()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this? I guess index row_id is always 0 or 1? And is it only used in explain display?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants